package com.mediatecture.flex.component.OpenSaveHelper
{
	import flash.filesystem.File;
	import flash.filesystem.FileMode;
	import flash.filesystem.FileStream;
	import flash.xml.XMLDocument;
	
	import mx.controls.Alert;
	import mx.core.FlexGlobals;
	import mx.resources.ResourceManager;
	import mx.rpc.xml.SimpleXMLDecoder;
	
	import Controller.AreasController;
	import Controller.HeatingController;
	import Controller.ProjectDataController;
	import Controller.QualityController;
	import Controller.ShadingController;
	import Controller.TransparentComponentController;
	
	import Model.ComplexSolidComponent;
	import Model.Construction;
	import Model.HeatRecoverySystem;
	import Model.HeatedSpaceArea;
	import Model.HeatedSpaceVolume;
	import Model.Project;
	import Model.Shading;
	import Model.ShadingSubject;
	import Model.SolidComponent;
	import Model.SubsoilHeatExchanger;
	import Model.TransparentComponent;

	public class XMLOpener
	{
		private var xmlDecoder:SimpleXMLDecoder;
		private var projectDataController:ProjectDataController;
		private var qualityDataController:QualityController;
		private var heatDataController:HeatingController;
		private var areasDataController:AreasController;
		private var transparentController:TransparentComponentController;
		
		public function XMLOpener()
		{
			this.xmlDecoder = new SimpleXMLDecoder();
			this.projectDataController = new ProjectDataController();
			this.areasDataController = new AreasController();
			this.qualityDataController = new QualityController();
			this.heatDataController = new HeatingController();
			this.transparentController = new TransparentComponentController();
		}
		
		public function open(fileToBeOpened:File):void
		{
			var fileStream:FileStream = new FileStream();
			fileStream.open(fileToBeOpened, FileMode.READ);
			
			var string:String = fileStream.readUTFBytes(fileStream.bytesAvailable);
			
			var xmlDoc:XMLDocument = new XMLDocument(string);
			var resultObject:Object = this.xmlDecoder.decodeXML(xmlDoc);
			// translate the result in Project object
			this.translateResultObjectToProjectObject(resultObject);

			// Updates the user interface
			this.projectDataController.updatePrjectDataUI();
			this.areasDataController.updateAreaInputUIData();
			this.qualityDataController.updateQualityUIData();
			ShadingController.updateShadingUIWindow();
			this.heatDataController.updateHeatingUIData();
			
			FlexGlobals.topLevelApplication.overviewPalette.updateAllSectionsData();
			transparentController.updateTransparentComponentsStatus();
		}
		
		private function returnEmptyStringIfNull(input:String):String
		{
			if(input == null)
				return "";
			else
				return input;
		}
		
		private function getNumberOutOfTheId(id:String):Number
		{
			var result:Number;
			
			result = Number(id.slice(2));
			
			return result;
		}
		
		private function changeCounterOfWindows(id:String):void
		{
			if(getNumberOutOfTheId(id) >=  TransparentComponent.windowCounter)
			{
				TransparentComponent.windowCounter = getNumberOutOfTheId(id) + 1;
			}
		}
		
		private function changeCounterOfDoors(id:String):void
		{
			if(getNumberOutOfTheId(id) >=  TransparentComponent.doorCounter)
			{
				TransparentComponent.doorCounter = getNumberOutOfTheId(id) + 1;
			}
		}
		
		private function changeCounterOfHeatedAreas(id:String):void
		{
			if(getNumberOutOfTheId(id) >=  HeatedSpaceArea.counter)
			{
				HeatedSpaceArea.counter = getNumberOutOfTheId(id) + 1;
			}
		}
		
		private function changeCounterOfHeatedVolumes(id:String):void
		{
			if(getNumberOutOfTheId(id) >=  HeatedSpaceVolume.counter)
			{
				HeatedSpaceVolume.counter = getNumberOutOfTheId(id) + 1;
			}
		}
		
		private function changeCounterOfSolidComponents(description:String, id:String):void
		{
			if(description == ResourceManager.getInstance().getString('systemtexts','exteriorWallToAmbientAir') && getNumberOutOfTheId(id) >=  SolidComponent.wallToAirCounter)
			{
				SolidComponent.wallToAirCounter = getNumberOutOfTheId(id) + 1;
			}
			else if(description == ResourceManager.getInstance().getString('systemtexts','exteriorWallToGround')&& getNumberOutOfTheId(id) >=  SolidComponent.wallToGroundCounter)
			{
				SolidComponent.wallToGroundCounter = getNumberOutOfTheId(id) + 1;
			}
			else if(description == ResourceManager.getInstance().getString('systemtexts','roofAreaSloped')&& getNumberOutOfTheId(id) >= SolidComponent.roofSlopedCounter)
			{
				SolidComponent.roofSlopedCounter = getNumberOutOfTheId(id) + 1;
			}
			else if(description == ResourceManager.getInstance().getString('systemtexts','roofAreaFlat') && getNumberOutOfTheId(id) >=  SolidComponent.roofFlatCounter)
			{
				SolidComponent.roofFlatCounter = getNumberOutOfTheId(id) + 1;
			}
			else if(description == ResourceManager.getInstance().getString('systemtexts','groundSlab') && getNumberOutOfTheId(id) >=  SolidComponent.slabCounter)
			{
				SolidComponent.slabCounter = getNumberOutOfTheId(id) + 1;
			}
			else if(description == ResourceManager.getInstance().getString('systemtexts','groundSlabAgainstCellar') && getNumberOutOfTheId(id) >=  SolidComponent.slabToUnheatedCellarCounter)
			{
				SolidComponent.slabToUnheatedCellarCounter = getNumberOutOfTheId(id) + 1;
			}
		}
		
		public function translateResultObjectToProjectObject(object:Object):void
		{
			if(ResourceManager.getInstance().localeChain[0] != object.ISOVERDesignerProject.language)
			{
				Alert.show("The project you attempt to open is saved in different language! Please change the language first!", "Warning", Alert.OK);			
			}
			else
			{
				FlexGlobals.topLevelApplication.project = new Project();
				
				FlexGlobals.topLevelApplication.project.areas.addEventListener("changedProperty", FlexGlobals.topLevelApplication.onAreasChange);
				FlexGlobals.topLevelApplication.project.quality.addEventListener("changedProperty", FlexGlobals.topLevelApplication.onAreasChange);
				FlexGlobals.topLevelApplication.project.heating.addEventListener("changedProperty", FlexGlobals.topLevelApplication.onAreasChange);
				
				var project:Project = FlexGlobals.topLevelApplication.project;
				//Project Data
					//----Object
	
				project.language = object.ISOVERDesignerProject.language;
				
				project.projectInfo.object.address.street = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.object.address.street);
				project.projectInfo.object.address.town = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.object.address.town);
				project.projectInfo.object.address.country = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.object.address.country);
				project.projectInfo.object.name = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.object.name);
					//---Builder
				project.projectInfo.builder.address.street = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.builder.address.street);
				project.projectInfo.builder.address.town = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.builder.address.town);
				project.projectInfo.builder.address.country = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.builder.address.country);
				project.projectInfo.builder.name = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.builder.name);
					//---Architect
				project.projectInfo.architect.address.street = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.architect.address.street);
				project.projectInfo.architect.address.town = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.architect.address.town);
				project.projectInfo.architect.address.country = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.architect.address.country);
				project.projectInfo.architect.name = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.architect.name);
					//---Climate Zone
				project.projectInfo.climateZone.countryId = object.ISOVERDesignerProject.projectInfo.climateZone.countryId;
				project.projectInfo.climateZone.globalEast = object.ISOVERDesignerProject.projectInfo.climateZone.globalEast;
				project.projectInfo.climateZone.globalSouth = object.ISOVERDesignerProject.projectInfo.climateZone.globalSouth;
				project.projectInfo.climateZone.globalNorth = object.ISOVERDesignerProject.projectInfo.climateZone.globalNorth;
				project.projectInfo.climateZone.globalWest = object.ISOVERDesignerProject.projectInfo.climateZone.globalWest;
				project.projectInfo.climateZone.globalHorizontal = object.ISOVERDesignerProject.projectInfo.climateZone.globalHorizontal;
				project.projectInfo.climateZone.gt = object.ISOVERDesignerProject.projectInfo.climateZone.gt;
				project.projectInfo.climateZone.ht = object.ISOVERDesignerProject.projectInfo.climateZone.ht;
				project.projectInfo.climateZone.label = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.climateZone.label);
					//---Type of construction
				project.projectInfo.typeConstruction = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.typeConstruction);
					//---Building Type
				project.projectInfo.buildingType = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.buildingType);
					//---Usage
				project.projectInfo.usage = returnEmptyStringIfNull(object.ISOVERDesignerProject.projectInfo.usage);
					//---Iterior temperature
				project.projectInfo.interiorTemperature = object.ISOVERDesignerProject.projectInfo.interiorTemperature;
				
				
				//Shading
				project.shading.shadingInputType = returnEmptyStringIfNull(object.ISOVERDesignerProject.shading.shadingInputType);
				
				var shadingFromHouses:ShadingSubject = new ShadingSubject();
				
				var shadingHousesEast:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromHouses.shadingEast.direction);
				shadingHousesEast.alpha = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingEast.alpha;
				shadingHousesEast.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingEast.correctionFactor;
				shadingHousesEast.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingEast.shadingFactor;
				shadingHousesEast.xAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingEast.xAxis;
				shadingHousesEast.yAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingEast.yAxis;
				var shadingHousesWest:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromHouses.shadingWest.direction);
				shadingHousesWest.alpha = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingWest.alpha;
				shadingHousesWest.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingWest.correctionFactor;
				shadingHousesWest.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingWest.shadingFactor;
				shadingHousesWest.xAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingWest.xAxis;
				shadingHousesWest.yAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingWest.yAxis;
				var shadingHousesNorth:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorth.direction);
				shadingHousesNorth.alpha = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorth.alpha;
				shadingHousesNorth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorth.correctionFactor;
				shadingHousesNorth.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorth.shadingFactor;
				shadingHousesNorth.xAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorth.xAxis;
				shadingHousesNorth.yAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorth.yAxis;
				var shadingHousesSouth:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouth.direction);
				shadingHousesSouth.alpha = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouth.alpha;
				shadingHousesSouth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouth.correctionFactor;
				shadingHousesSouth.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouth.shadingFactor;
				shadingHousesSouth.xAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouth.xAxis;
				shadingHousesSouth.yAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouth.yAxis;
				var shadingHousesSouthEast:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouthEast.direction);
				shadingHousesSouthEast.alpha = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouthEast.alpha;
				shadingHousesSouth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouthEast.correctionFactor;
				shadingHousesSouthEast.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouthEast.shadingFactor;
				shadingHousesSouthEast.xAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouthEast.xAxis;
				shadingHousesSouthEast.yAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouthEast.yAxis;
				var shadingHousesSouthWest:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouthWest.direction);
				shadingHousesSouthWest.alpha = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouthWest.alpha;
				shadingHousesSouth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouthWest.correctionFactor;
				shadingHousesSouthWest.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouthWest.shadingFactor;
				shadingHousesSouthWest.xAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouthWest.xAxis;
				shadingHousesSouthWest.yAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingSouthWest.yAxis;
				var shadingHousesNorthWest:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorthWest.direction);
				shadingHousesNorthWest.alpha = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorthWest.alpha;
				shadingHousesSouth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorthWest.correctionFactor;
				shadingHousesNorthWest.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorthWest.shadingFactor;
				shadingHousesNorthWest.xAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorthWest.xAxis;
				shadingHousesNorthWest.yAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorthWest.yAxis;
				var shadingHousesNorthEast:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorthEast.direction);
				shadingHousesNorthEast.alpha = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorthEast.alpha;
				shadingHousesSouth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorthEast.correctionFactor;
				shadingHousesNorthEast.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorthEast.shadingFactor;
				shadingHousesNorthEast.xAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorthEast.xAxis;
				shadingHousesNorthEast.yAxis = object.ISOVERDesignerProject.shading.shadingFromHouses.shadingNorthEast.yAxis;
				
				shadingFromHouses.shadingEast = shadingHousesEast;
				shadingFromHouses.shadingNorth = shadingHousesNorth;
				shadingFromHouses.shadingSouth = shadingHousesSouth;
				shadingFromHouses.shadingWest = shadingHousesWest;
				shadingFromHouses.shadingNorthEast = shadingHousesNorthEast;
				shadingFromHouses.shadingNorthWest = shadingHousesNorthWest;
				shadingFromHouses.shadingSouthWest = shadingHousesSouthWest;
				shadingFromHouses.shadingSouthEast = shadingHousesSouthEast;
				
				project.shading.shadingFromHouses = shadingFromHouses;
				
				var shadingFromTrees:ShadingSubject = new ShadingSubject();
				
				var shadingTreesEast:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromTrees.shadingEast.direction);
				shadingTreesEast.alpha = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingEast.alpha;
				shadingTreesEast.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingEast.correctionFactor;
				shadingTreesEast.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingEast.shadingFactor;
				shadingTreesEast.xAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingEast.xAxis;
				shadingTreesEast.yAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingEast.yAxis;
				var shadingTreesWest:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromTrees.shadingWest.direction);
				shadingTreesWest.alpha = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingWest.alpha;
				shadingTreesWest.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingWest.correctionFactor;
				shadingTreesWest.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingWest.shadingFactor;
				shadingTreesWest.xAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingWest.xAxis;
				shadingTreesWest.yAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingWest.yAxis;
				var shadingTreesNorth:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorth.direction);
				shadingTreesNorth.alpha = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorth.alpha;
				shadingTreesNorth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorth.correctionFactor;
				shadingTreesNorth.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorth.shadingFactor;
				shadingTreesNorth.xAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorth.xAxis;
				shadingTreesNorth.yAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorth.yAxis;
				var shadingTreesSouth:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouth.direction);
				shadingTreesSouth.alpha = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouth.alpha;
				shadingTreesSouth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouth.correctionFactor;
				shadingTreesSouth.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouth.shadingFactor;
				shadingTreesSouth.xAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouth.xAxis;
				shadingTreesSouth.yAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouth.yAxis;
				var shadingTreesSouthEast:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouthEast.direction);
				shadingTreesSouthEast.alpha = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouthEast.alpha;
				shadingTreesSouth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouthEast.correctionFactor;
				shadingTreesSouthEast.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouthEast.shadingFactor;
				shadingTreesSouthEast.xAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouthEast.xAxis;
				shadingTreesSouthEast.yAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouthEast.yAxis;
				var shadingTreesSouthWest:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouthWest.direction);
				shadingTreesSouthWest.alpha = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouthWest.alpha;
				shadingTreesSouth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouthWest.correctionFactor;
				shadingTreesSouthWest.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouthWest.shadingFactor;
				shadingTreesSouthWest.xAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouthWest.xAxis;
				shadingTreesSouthWest.yAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingSouthWest.yAxis;
				var shadingTreesNorthWest:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorthWest.direction);
				shadingTreesNorthWest.alpha = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorthWest.alpha;
				shadingTreesSouth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorthWest.correctionFactor;
				shadingTreesNorthWest.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorthWest.shadingFactor;
				shadingTreesNorthWest.xAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorthWest.xAxis;
				shadingTreesNorthWest.yAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorthWest.yAxis;
				var shadingTreesNorthEast:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorthEast.direction);
				shadingTreesNorthEast.alpha = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorthEast.alpha;
				shadingTreesSouth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorthEast.correctionFactor;
				shadingTreesNorthEast.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorthEast.shadingFactor;
				shadingTreesNorthEast.xAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorthEast.xAxis;
				shadingTreesNorthEast.yAxis = object.ISOVERDesignerProject.shading.shadingFromTrees.shadingNorthEast.yAxis;
				
				
				shadingFromTrees.shadingEast = shadingTreesEast;
				shadingFromTrees.shadingNorth = shadingTreesNorth;
				shadingFromTrees.shadingSouth = shadingTreesSouth;
				shadingFromTrees.shadingWest = shadingTreesWest;
				shadingFromTrees.shadingNorthEast = shadingTreesNorthEast;
				shadingFromTrees.shadingNorthWest = shadingTreesNorthWest;
				shadingFromTrees.shadingSouthWest = shadingTreesSouthWest;
				shadingFromTrees.shadingSouthEast = shadingTreesSouthEast;
				
				project.shading.shadingFromTrees = shadingFromTrees;
				
				var shadingFromBalconies:ShadingSubject = new ShadingSubject();
				
				var shadingBalconiesEast:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingEast.direction);
				shadingBalconiesEast.alpha = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingEast.alpha;
				shadingBalconiesEast.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingEast.correctionFactor;
				shadingBalconiesEast.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingEast.shadingFactor;
				shadingBalconiesEast.xAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingEast.xAxis;
				shadingBalconiesEast.yAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingEast.yAxis;
				var shadingBalconiesWest:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingWest.direction);
				shadingBalconiesWest.alpha = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingWest.alpha;
				shadingBalconiesWest.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingWest.correctionFactor;
				shadingBalconiesWest.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingWest.shadingFactor;
				shadingBalconiesWest.xAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingWest.xAxis;
				shadingBalconiesWest.yAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingWest.yAxis;
				var shadingBalconiesNorth:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorth.direction);
				shadingBalconiesNorth.alpha = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorth.alpha;
				shadingBalconiesNorth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorth.correctionFactor;
				shadingBalconiesNorth.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorth.shadingFactor;
				shadingBalconiesNorth.xAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorth.xAxis;
				shadingBalconiesNorth.yAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorth.yAxis;
				var shadingBalconiesSouth:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouth.direction);
				shadingBalconiesSouth.alpha = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouth.alpha;
				shadingBalconiesSouth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouth.correctionFactor;
				shadingBalconiesSouth.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouth.shadingFactor;
				shadingBalconiesSouth.xAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouth.xAxis;
				shadingBalconiesSouth.yAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouth.yAxis;
				var shadingBalconiesSouthEast:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouthEast.direction);
				shadingBalconiesSouthEast.alpha = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouthEast.alpha;
				shadingBalconiesSouth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouthEast.correctionFactor;
				shadingBalconiesSouthEast.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouthEast.shadingFactor;
				shadingBalconiesSouthEast.xAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouthEast.xAxis;
				shadingBalconiesSouthEast.yAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouthEast.yAxis;
				var shadingBalconiesSouthWest:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouthWest.direction);
				shadingBalconiesSouthWest.alpha = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouthWest.alpha;
				shadingBalconiesSouth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouthWest.correctionFactor;
				shadingBalconiesSouthWest.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouthWest.shadingFactor;
				shadingBalconiesSouthWest.xAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouthWest.xAxis;
				shadingBalconiesSouthWest.yAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingSouthWest.yAxis;
				var shadingBalconiesNorthWest:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorthWest.direction);
				shadingBalconiesNorthWest.alpha = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorthWest.alpha;
				shadingBalconiesSouth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorthWest.correctionFactor;
				shadingBalconiesNorthWest.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorthWest.shadingFactor;
				shadingBalconiesNorthWest.xAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorthWest.xAxis;
				shadingBalconiesNorthWest.yAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorthWest.yAxis;
				var shadingBalconiesNorthEast:Shading = new Shading(object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorthEast.direction);
				shadingBalconiesNorthEast.alpha = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorthEast.alpha;
				shadingBalconiesSouth.correctionFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorthEast.correctionFactor;
				shadingBalconiesNorthEast.shadingFactor = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorthEast.shadingFactor;
				shadingBalconiesNorthEast.xAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorthEast.xAxis;
				shadingBalconiesNorthEast.yAxis = object.ISOVERDesignerProject.shading.shadingFromBalconies.shadingNorthEast.yAxis;
				
				shadingFromBalconies.shadingEast = shadingBalconiesEast;
				shadingFromBalconies.shadingNorth = shadingBalconiesNorth;
				shadingFromBalconies.shadingSouth = shadingBalconiesSouth;
				shadingFromBalconies.shadingWest = shadingBalconiesWest;
				shadingFromBalconies.shadingNorthEast = shadingBalconiesNorthEast;
				shadingFromBalconies.shadingNorthWest = shadingBalconiesNorthWest;
				shadingFromBalconies.shadingSouthWest = shadingBalconiesSouthWest;
				shadingFromBalconies.shadingSouthEast = shadingBalconiesSouthEast;
				
				project.shading.shadingFromBalconies = shadingFromBalconies;
				
				///Areas
				
				project.areas.selectedSystem = returnEmptyStringIfNull(object.ISOVERDesignerProject.areas.selectedSystem);
				project.areas.totalHeatedSpaceArea = object.ISOVERDesignerProject.areas.totalHeatedSpaceArea;
				project.areas.totalHeatedSpaceVolume = object.ISOVERDesignerProject.areas.totalHeatedSpaceVolume;
					//---Heated Space Areas
				HeatedSpaceArea.counter = 1;
				var heatedSpaceAreasObject:Object = object.ISOVERDesignerProject.areas.heatedSpaceAreas;
				var hsaCounter:Number = 0;
				var newHSA:HeatedSpaceArea;
				if(heatedSpaceAreasObject.item is Array)
				{
					for each(var heatedSpaceArea:Object in heatedSpaceAreasObject.item)
					{	
						if(hsaCounter == 0)
						{
							(project.areas.heatedSpaceAreas[hsaCounter] as HeatedSpaceArea).description = heatedSpaceArea.description;
							(project.areas.heatedSpaceAreas[hsaCounter] as HeatedSpaceArea).id = heatedSpaceArea.id;
							changeCounterOfHeatedAreas(heatedSpaceArea.id);
							(project.areas.heatedSpaceAreas[hsaCounter] as HeatedSpaceArea).quantity = heatedSpaceArea.quantity;
							(project.areas.heatedSpaceAreas[hsaCounter] as HeatedSpaceArea).livingArea = heatedSpaceArea.livingArea;
							(project.areas.heatedSpaceAreas[hsaCounter] as HeatedSpaceArea).estimation = heatedSpaceArea.estimation;
							(project.areas.heatedSpaceAreas[hsaCounter] as HeatedSpaceArea).areaType = heatedSpaceArea.areaType;
							
							project.areas.heatedSpaceAreas.itemUpdated(project.areas.heatedSpaceAreas[hsaCounter]);
						}
						else
						{
							newHSA = new HeatedSpaceArea();
							newHSA.description = heatedSpaceArea.description;
							newHSA.id = heatedSpaceArea.id;
							changeCounterOfHeatedAreas(heatedSpaceArea.id);
							newHSA.quantity = heatedSpaceArea.quantity;
							newHSA.livingArea = heatedSpaceArea.livingArea;
							newHSA.estimation = heatedSpaceArea.estimation;
							newHSA.areaType = heatedSpaceArea.areaType;
							
							project.areas.heatedSpaceAreas.addItem(newHSA);
						}
		
						hsaCounter ++
					}
					hsaCounter = 0;
				}
				else
				{
					(project.areas.heatedSpaceAreas[0] as HeatedSpaceArea).description = heatedSpaceAreasObject.item.description;
					(project.areas.heatedSpaceAreas[0] as HeatedSpaceArea).id = heatedSpaceAreasObject.item.id;
					changeCounterOfHeatedAreas(heatedSpaceAreasObject.item.id);
					(project.areas.heatedSpaceAreas[0] as HeatedSpaceArea).quantity = heatedSpaceAreasObject.item.quantity;
					(project.areas.heatedSpaceAreas[0] as HeatedSpaceArea).livingArea = heatedSpaceAreasObject.item.livingArea;
					(project.areas.heatedSpaceAreas[0] as HeatedSpaceArea).estimation = heatedSpaceAreasObject.item.estimation;
					(project.areas.heatedSpaceAreas[0] as HeatedSpaceArea).areaType = heatedSpaceAreasObject.item.areaType;
				}
					//---Heated Space Volumes
				HeatedSpaceVolume.counter = 1;
				var heatedSpaceVolumesObject:Object = object.ISOVERDesignerProject.areas.heatedSpaceVolumes;
				var hsvCounter:Number = 0;
				var newHSV:HeatedSpaceVolume;
	
				if(heatedSpaceVolumesObject.item is Array)
				{
					for each(var heatedSpaceVolume:Object in heatedSpaceVolumesObject.item)
					{
						if(hsvCounter == 0)
						{
							(project.areas.heatedSpaceVolumes[hsvCounter] as HeatedSpaceVolume).description = heatedSpaceVolume.description;
							(project.areas.heatedSpaceVolumes[hsvCounter] as HeatedSpaceVolume).id = heatedSpaceVolume.id;
							changeCounterOfHeatedVolumes(heatedSpaceVolume.id);
							(project.areas.heatedSpaceVolumes[hsvCounter] as HeatedSpaceVolume).quantity = heatedSpaceVolume.quantity;
							(project.areas.heatedSpaceVolumes[hsvCounter] as HeatedSpaceVolume).area = heatedSpaceVolume.area;
							(project.areas.heatedSpaceVolumes[hsvCounter] as HeatedSpaceVolume).height = heatedSpaceVolume.height;
							(project.areas.heatedSpaceVolumes[hsvCounter] as HeatedSpaceVolume).volume = heatedSpaceVolume.volume;
						}
						else
						{
							newHSV = new HeatedSpaceVolume();
							newHSV.description = heatedSpaceVolume.description;
							newHSV.id = heatedSpaceVolume.id;
							changeCounterOfHeatedVolumes(heatedSpaceVolume.id);
							newHSV.quantity = heatedSpaceVolume.quantity;
							newHSV.area = heatedSpaceVolume.area;
							newHSV.height = heatedSpaceVolume.height;
							newHSV.volume = heatedSpaceVolume.volume;
							
							project.areas.heatedSpaceVolumes.addItem(newHSV);
						}
						
						hsvCounter++;
					}
					hsvCounter = 0;
				}
				else
				{
					(project.areas.heatedSpaceVolumes[0] as HeatedSpaceVolume).description = heatedSpaceVolumesObject.item.description;
					(project.areas.heatedSpaceVolumes[0] as HeatedSpaceVolume).id = heatedSpaceVolumesObject.item.id;
					changeCounterOfHeatedVolumes(heatedSpaceVolumesObject.item.id);
					(project.areas.heatedSpaceVolumes[0] as HeatedSpaceVolume).quantity = heatedSpaceVolumesObject.item.quantity;
					(project.areas.heatedSpaceVolumes[0] as HeatedSpaceVolume).area = heatedSpaceVolumesObject.item.area;
					(project.areas.heatedSpaceVolumes[0] as HeatedSpaceVolume).height = heatedSpaceVolumesObject.item.height;
					(project.areas.heatedSpaceVolumes[0] as HeatedSpaceVolume).volume = heatedSpaceVolumesObject.item.volume;
				}
					
				//---Solid Components
				project.areas.solidComponents.removeAll();
				
				SolidComponent.roofFlatCounter = 1;
				SolidComponent.roofSlopedCounter = 1;
				SolidComponent.slabCounter = 1;
				SolidComponent.slabToUnheatedCellarCounter = 1;
				SolidComponent.wallToAirCounter = 1;
				SolidComponent.wallToGroundCounter = 1;
				TransparentComponent.doorCounter = 1;
				TransparentComponent.windowCounter = 1;
				
				var solidComponentsObject:Object = object.ISOVERDesignerProject.areas.solidComponents;
				var newSolidComponent:SolidComponent;
				var newComplexSolidComponent:ComplexSolidComponent;
				
				if(solidComponentsObject != null)
				{
					if(solidComponentsObject.item is Array)
					{
						for each(var solidComponent:Object in solidComponentsObject.item)
						{
							if(solidComponent.hasOwnProperty("orientation"))
							{
								newComplexSolidComponent = new ComplexSolidComponent( solidComponent.description);
								newComplexSolidComponent.id = solidComponent.id;
								changeCounterOfSolidComponents(solidComponent.description, solidComponent.id)
								newComplexSolidComponent.quantity = solidComponent.quantity;
								newComplexSolidComponent.length = solidComponent.length;
								newComplexSolidComponent.height = solidComponent.height;
								newComplexSolidComponent.estimation = solidComponent.estimation;
								newComplexSolidComponent.area = solidComponent.area;
								newComplexSolidComponent.orientation = solidComponent.orientation;
								if(solidComponent.construction != null)
								{
									newComplexSolidComponent.construction = new Construction(
										solidComponent.construction.name, solidComponent.construction.imageURL, 
										solidComponent.construction.uValue, solidComponent.construction.psiValue, 
										solidComponent.construction.gValue,solidComponent.construction.parentId);
									if(solidComponent.construction.hasOwnProperty("cutInfo"))
									{
										newComplexSolidComponent.construction.cutInfo.dimensions = returnEmptyStringIfNull(solidComponent.construction.cutInfo.dimensions);
										newComplexSolidComponent.construction.cutInfo.layersNames = returnEmptyStringIfNull(solidComponent.construction.cutInfo.layersNames);
									}
								}
	
								if(solidComponent.doors != null)
								{
									var newDoor:TransparentComponent;
									
									if(solidComponent.doors.item is Array)
									{
										newComplexSolidComponent.doors.removeAll();
										for each(var door:Object in solidComponent.doors.item)
										{
											newDoor =new TransparentComponent("door");
											newDoor.description = door.description;
											newDoor.id = door.id;
											changeCounterOfDoors(door.id);
											newDoor.quantity = door.quantity;
											newDoor.parentComponent = door.parentComponent;
											newDoor.length =  door.length;
											newDoor.height = door.height;
											newDoor.estimation = door.estimation;
											newDoor.area = door.area;
							
											
											if(door.construction != null)
											{
												newDoor.construction = new Construction(
													door.construction.name, door.construction.imageURL, 
													door.construction.uValue, door.construction.psiValue, 
													door.construction.gValue, door.construction.parentId);
												if(door.construction.hasOwnProperty("cutInfo"))
												{
													newDoor.construction.cutInfo.dimensions = returnEmptyStringIfNull(door.construction.cutInfo.dimensions);
													newDoor.construction.cutInfo.layersNames = returnEmptyStringIfNull(door.construction.cutInfo.layersNames);
												}
											}
											newComplexSolidComponent.doors.addItem(newDoor);
											newDoor = null;
										}
									}
									else
									{
									
										newDoor = new TransparentComponent("door");
										newDoor.description = solidComponent.doors.item.description;
										newDoor.id = solidComponent.doors.item.id;
										changeCounterOfDoors(solidComponent.doors.item.id);
										newDoor.quantity = solidComponent.doors.item.quantity;
										newDoor.parentComponent = solidComponent.doors.item.parentComponent;
										newDoor.length =  solidComponent.doors.item.length;
										newDoor.height = solidComponent.doors.item.height;
										newDoor.estimation = solidComponent.doors.item.estimation
										newDoor.area = solidComponent.doors.item.area;
											
										if(solidComponent.doors.item.construction != null)
										{
											newDoor.construction = new Construction(
												solidComponent.doors.item.construction.name, solidComponent.doors.item.construction.imageURL, 
												solidComponent.doors.item.construction.uValue, solidComponent.doors.item.construction.psiValue, 
												solidComponent.doors.item.construction.gValue, solidComponent.doors.item.construction.parentId);
											
											if(solidComponent.doors.item.construction.hasOwnProperty("cutInfo"))
											{
												newDoor.construction.cutInfo.dimensions = returnEmptyStringIfNull(solidComponent.doors.item.construction.cutInfo.dimensions);
												newDoor.construction.cutInfo.layersNames = returnEmptyStringIfNull(solidComponent.doors.item.construction.cutInfo.layersNames);
											}
										}
										
										newComplexSolidComponent.doors.addItem(newDoor);
										newDoor = null;
									}
									
								}
								
								if(solidComponent.windows != null)
								{
									var newWindow:TransparentComponent;
									
									if(solidComponent.windows.item is Array)
									{
										newComplexSolidComponent.windows.removeAll();
										
										for each(var window:Object in solidComponent.windows.item)
										{
											newWindow = new TransparentComponent("window");
											newWindow.description = window.description;
											newWindow.id = window.id;
											changeCounterOfWindows(window.id);
											newWindow.quantity = window.quantity;
											newWindow.parentComponent = window.parentComponent;
											newWindow.length =  window.length;
											newWindow.height = window.height;
											newWindow.estimation = window.estimation;
											newWindow.area = window.area;
							
											if(window.construction != null)
											{
												newWindow.construction = new Construction(window.construction.name, window.construction.imageURL, 
													window.construction.uValue, window.construction.psiValue, 
													window.construction.gValue, window.construction.parentId);
												
												if(window.construction.hasOwnProperty("cutInfo"))
												{
													newWindow.construction.cutInfo.dimensions = returnEmptyStringIfNull(window.construction.cutInfo.dimensions);
													newWindow.construction.cutInfo.layersNames = returnEmptyStringIfNull(window.construction.cutInfo.layersNames);
												}
											}
											
											newComplexSolidComponent.windows.addItem(newWindow);
											
											newWindow = null;
										}
									}
									else
									{
										newWindow = new TransparentComponent("window");
										newWindow.description = solidComponent.windows.item.description;
										newWindow.id = solidComponent.windows.item.id;
										changeCounterOfWindows(solidComponent.windows.item.id);
										newWindow.quantity = solidComponent.windows.item.quantity;
										newWindow.parentComponent = solidComponent.windows.item.parentComponent;
										newWindow.length =  solidComponent.windows.item.length;
										newWindow.height = solidComponent.windows.item.height;
										newWindow.estimation = solidComponent.windows.item.estimation;
										newWindow.area = solidComponent.windows.item.area;
										
										if(solidComponent.windows.item.construction != null)
										{
											newWindow.construction = new Construction(
												solidComponent.windows.item.construction.name, solidComponent.windows.item.construction.imageURL, 
												solidComponent.windows.item.construction.uValue, solidComponent.windows.item.construction.psiValue, 
												solidComponent.windows.item.construction.gValue, solidComponent.windows.item.construction.parentId);
											
											if(solidComponent.windows.item.construction.hasOwnProperty("cutInfo"))
											{
												newWindow.construction.cutInfo.dimensions = returnEmptyStringIfNull(solidComponent.windows.item.construction.cutInfo.dimensions);
												newWindow.construction.cutInfo.layersNames = returnEmptyStringIfNull(solidComponent.windows.item.construction.cutInfo.layersNames);
											}
										}
										
										newComplexSolidComponent.windows.addItem(newWindow);
										newWindow = null;
									}
								}
	
								project.areas.solidComponents.addItem(newComplexSolidComponent);
	
								
							}
							else
							{			
								newSolidComponent = new SolidComponent(solidComponent.description);
								newSolidComponent.id = solidComponent.id;
								changeCounterOfSolidComponents(solidComponent.description, solidComponent.id)
								newSolidComponent.quantity = solidComponent.quantity;
								newSolidComponent.length = solidComponent.length;
								newSolidComponent.height = solidComponent.height;
								newSolidComponent.estimation = solidComponent.estimation;
								newSolidComponent.area = solidComponent.area;
								
								if(solidComponent.construction != null)
								{
									newSolidComponent.construction = new Construction(
										solidComponent.construction.name, solidComponent.construction.imageURL, 
										solidComponent.construction.uValue, solidComponent.construction.psiValue, 
										solidComponent.construction.gValue, solidComponent.construction.parentId)
										
									if(solidComponent.construction.hasOwnProperty("cutInfo"))
									{
										newSolidComponent.construction.cutInfo.dimensions = returnEmptyStringIfNull(solidComponent.construction.cutInfo.dimensions);
										newSolidComponent.construction.cutInfo.layersNames = returnEmptyStringIfNull(solidComponent.construction.cutInfo.layersNames);
									}
								}
	
								project.areas.solidComponents.addItem(newSolidComponent);
	
							}
						}
					}
					else
					{
						newSolidComponent = new SolidComponent(solidComponentsObject.item.description);
						newSolidComponent.id = solidComponentsObject.item.id;
						newSolidComponent.quantity = solidComponentsObject.item.quantity;
						newSolidComponent.length = solidComponentsObject.item.length;
						newSolidComponent.height = solidComponentsObject.item.height;
						newSolidComponent.estimation = solidComponentsObject.item.estimation;
						newSolidComponent.area = solidComponentsObject.item.area;
						
						if(solidComponentsObject.item.construction != null)
						{
							newSolidComponent.construction = new Construction(
								solidComponentsObject.item.construction.name, solidComponentsObject.item.construction.imageURL, 
								solidComponentsObject.item.construction.uValue, solidComponentsObject.item.construction.psiValue, 
								solidComponentsObject.item.construction.gValue, solidComponentsObject.item.construction.parentId);
							
							if(solidComponentsObject.item.construction.hasOwnProperty("cutInfo"))
							{
								newSolidComponent.construction.cutInfo.dimensions = returnEmptyStringIfNull(solidComponentsObject.item.construction.cutInfo.dimensions);
								newSolidComponent.construction.cutInfo.layersNames = returnEmptyStringIfNull(solidComponentsObject.item.construction.cutInfo.layersNames);
							}
							
						}
	
						project.areas.solidComponents.addItem(newSolidComponent);
	
						newSolidComponent = null;
					}
				}
				
				
				///Quality 
				project.quality.airtightnessRate = object.ISOVERDesignerProject.quality.airtightnessRate;
				project.quality.thermalBridgeFree = object.ISOVERDesignerProject.quality.thermalBridgeFree;
				
				///Heating
					//---HeatRecoverySystem	
				project.heating.heatRecoverySystem = new HeatRecoverySystem(object.ISOVERDesignerProject.heating.heatRecoverySystem.type,
					object.ISOVERDesignerProject.heating.heatRecoverySystem.description,
					object.ISOVERDesignerProject.heating.heatRecoverySystem.efficiency,
					object.ISOVERDesignerProject.heating.heatRecoverySystem.pictureURL);
					
					//---Subsoil Heat Exchanger
				var subsoilHeatExchanger = new SubsoilHeatExchanger();
				subsoilHeatExchanger.efficiency = object.ISOVERDesignerProject.heating.subsoilHeatExchanger.efficiency;
				subsoilHeatExchanger.length = object.ISOVERDesignerProject.heating.subsoilHeatExchanger.length;
				project.heating.subsoilHeatExchanger = subsoilHeatExchanger;
	
			}	
		}
	}
}